package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.media.pojos.WmUser;
import com.heima.wemedia.service.WmUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(value = "自媒体用户API",tags = "自媒体用户API")
@RequestMapping("/api/v1/user")
public class WmUserController {
    @Autowired
    private WmUserService wmUserService;

    //根据用户名查询自媒体用户
    @GetMapping("/findByName/{name}")
    @ApiOperation("根据用户名查询自媒体用户")
    public ResponseResult findByName(@PathVariable("name") String name){
        return wmUserService.findByName(name);
    }

    //保存自媒体用户
    @PostMapping("/save")
    @ApiOperation("保存自媒体用户")
    public ResponseResult save(@RequestBody WmUser wmUser){
        return wmUserService.insert(wmUser);
    }

}
